package com.bawei.module_goods.repository

import com.bawei.lib_net.RetrofitFactory
import com.bawei.module_goods.network.GoodsApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn

class GoodsRepository {
    val api: GoodsApi
    init {
        api= RetrofitFactory.getRetrofitFactory().create(GoodsApi::class.java)
    }

    suspend fun getBannerList()= flow {
        emit(api.getBannerList())
    }.flowOn(Dispatchers.IO)
    suspend fun getGroupList() = flow {
        emit(api.getGroupList())
    }.flowOn(Dispatchers.IO)

    suspend fun getEventList() = flow {
        emit(api.getEventList())
    }.flowOn(Dispatchers.IO)
    suspend fun getGoodsList() = flow {
        emit(api.getGoodsList())
    }.flowOn(Dispatchers.IO)
} 